// cd25 [dp动态规划]最长上升子序列 最长递增子序列
// https://www.nowcoder.com/practice/30fb9b3cab9742ecae9acda1c75bf927
//[LIS(Longest Increasing Subsequence)]
#include <iostream>
using namespace std;
int main() {
  int n, m = 0;
  int a[10000], dp[10000];
  while (cin >> n) {
    m = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      dp[i] = 1;
      for (int j = 0; j < i; j++) {
        if (a[i] > a[j]) {
          dp[i] = max(dp[i], dp[j] + 1);
        }
      }
      if (m < dp[i]) m = dp[i];
    }
    cout << m << endl;
  }
  return 0;
}
